<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>内容管理</title>
<link rel="stylesheet" type="text/css" href="template/admin.css"/>
<script type="text/javascript" src="template/images/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
	$('#sl_all').click(function(){
		$('table').find('#all').attr('checked','checked');
	});
	$('#show_list').find('tr').hover(function(){
		$(this).find('td').css('background','#ccffcc');
	},function(){
		$(this).find('td').css('background','');
	});
});
function set_act(){
alert($('#form1').find('#all').val());
}
</script>
<?php
	$tech_num = (count($tech_arr)-1);
	$show_tech = $tech_arr[rand(0,$tech_num)];
?>
<!--
<script type="text/javascript">

	$(document).ready(function(){
		$str = '<?php echo $show_tech;?>';
		$('#show_tech').html("<em>小提示：</em>"+$str).fadeIn('slow');
	});

</script>
-->
</head>

<body>
<div class="admin_position"><span>当前位置 > 添加内容</span><p id="show_tech" style="display:none"></p></div><!--位置-->
		<div class="lang">
			<ul>
			 <?php
 $cache_file=DATA_PATH."cache/lang_cache.php";
 $cache_arr=read_cache($cache_file,'lang_cache');
 if(!empty($cache_arr)){
 foreach($cache_arr as $k=>$v){
  if(!$v['lang_is_use']){continue;}
 ?>
 <li><a href="?action=content_list&id=<?php echo $id;?>&lang=<?php echo $v['lang_tag'];?>" class="<?php if($GLOBALS['lang']==$v['lang_tag']){echo 'hover';}?>"><?php echo $v['lang_name'];?></a></li>
 <?php
 }
 }
 ?>
			</ul>
		</div><!--语言-->
		
		
<div class="order_contain">
<form name="form" id="form1" method="post" action="" class="form">
<div class="list_sl_btn">
	<ul>
	<li><select name="cate2" style="width:200px; margin-top:2px;">
	<option value="">请选择栏目</option>
	<?php
		if(!empty($cate_list)){
			$cate_arr=array();
			foreach($cate_list as $k=>$v){
				if($v['cate_channel']==$id){
				$cate_arr[]=$cate_list[$k];
				}
			}
		}
		if(!empty($cate_arr)){
			foreach($cate_arr as $key=>$value){
				$ck='';
				if($value['id']==$cate2){$ck='selected=selected';}
				echo "<option value=\"{$value['id']}\" {$ck}>{$value['cate_name']}</option>";
			}
		}
	?>
	</select></li>
	<li><select name="order" style="margin-top:2px;">
	<option value="">排序</option>
	<option value="addtime" <?php if($order=='addtime'){echo 'selected="selected"';}?>>时间排序</option>
	<option value="hits" <?php if($order=='hits'){echo 'selected="selected"';}?>>点击排序</option>
	</select></li>
	<li><select name="verify" style="margin-top:2px;">
	<option value="0" <?php if(!intval($verify)){echo 'selected="selected"';}?>>审核</option>
	<option value="1" <?php if(intval($verify)){echo 'selected="selected"';}?>>未审核</option>
	</select></li>
	<li>关键字：<input type="text" name="key_words" value="<?php echo $key_words;?>" /></li>
	<li><input type="button" name="sousuo" value="搜索" class="go" onclick="javascript:this.form.action='admin_content.php?action=content_list&lang=<?php echo $lang;?>';this.form.submit();" /></li>
	</ul>
</div>

 <div class="order_main">
 <table cellpadding="0" cellspacing="0" width="100%">
 	<thead>
		<tr><th style="width:5%">选择</th><th style="width:5%; text-align:center">排序</th> <th style="width:35%">文章标题</th><th style="width:10%">添加时间</th><th style="width:10%">所属栏目</th><th style="width:10%">浏览权限</th><th style="width:5%">点击</th><th style="width:5%">状态</th><th style="width:5%">发布人</th><th style="width:10%">操作</th></tr>
	</thead>
	<tbody id="show_list">
	<?php
	foreach($c_arr as $k=>$v){
		if($id==$v['id']){
			$table=DB_PRE.$v['channel_table'];
			$channel=$v['channel_name'];
			$content_php=empty($v['content_php'])?'show_content.php':$v['content_php'];
		}
	}
	if(empty($table)||empty($channel)){
		msg('参数发生错误，不存在相关频道');
	}
	$maintb=DB_PRE."maintb";
	$page=empty($page)?1:$page;
	$pagesize=30;
	$pagenum=($page-1)*$pagesize;
	$filt="m.channel={$id} and m.lang='{$lang}'";
	$query='&id='.$id.'&lang='.$lang.'&action=content_list&order='.$order.'&keywords='.$keywords.'&cate2='.$cate2.'&verify='.$verify;
	$cate=empty($cate2)?$cate:$cate2;
	$child=get_child_id($cate);
	$a_category=empty($child)?$cate:$cate.$child;
	if(!empty($cate)){
		$filt.=" and m.category in ({$a_category})";
		$query.='&cate='.$cate;
		unset($cate);
	}
	$filt.=empty($verify)?'':' and m.verify='.$verify;
	$filt.=empty($key_words)?'':" and m.title like '%".$key_words."%'";
	$order=empty($order)?'order by m.c_order desc':'order by m.'.$order.' desc';
	$total_num=$GLOBALS['mysql']->fetch_rows("select m.id from {$maintb} as m where {$filt}");
	$total_page=ceil($total_num/$pagesize);
	$sql="select e.*,m.* from {$table} as e left join {$maintb} as m on e.id=m.id where {$filt}  {$order} limit {$pagenum},{$pagesize}";
	$rel=$GLOBALS['mysql']->fetch_asc($sql);
	if(!empty($rel)){
	foreach($rel as $key=>$value){
	//标题样式
			if($value['title_color']||$value['title_style']){
			$font_style='<font style="';
			$font_style.=empty($value['title_color'])?'':'color:'.$value['title_color'].';';
			if($value['title_style']==1){
			$font_style.='font-weight:bold;';
			}elseif($value['title_style']==2){
				$font_style.='font-style:italic;';
			}elseif($value['title_style']==3){
				$font_style.='text-decoration:underline;';
			}
			$font_style.='">';
			$font_style.=$value['title'];
			$font_style.="</font>";
			$value['style_title']=$font_style;//样式标题
			}else{
			$value['style_title']=$value['title'];
			}
			//开启生成检查是否生成
			$is_has_html='';
			if($_confing['web_html']){
				$is_has_html = @file_exists(CMS_PATH.$value['url'])?'<span style="color:#006600">已生成</span>':'<span style="color:#FF0000">未生成</span>';
			}
			//内容状态
			$fl_arr=empty($value['filter'])?'':explode(',',$value['filter']);
			$fl_str='';
			if($value['top']=='1'){$fl_str.='<span style="color:#3300CC">置顶</span>';}
			if(!empty($fl_arr)){
				foreach($fl_arr as $f_k=>$f_v){
					if($f_v=='a'){
						$fl_str.='<span style="color:#FF0000">[头条]</span>';
					}elseif($f_v=='b'){
						$fl_str.='<span style="color:#0099CC">[推荐]</span>';
					}elseif($f_v=='c'){
						$fl_str.='<span style="color:#00FF00">[图片]</span>';
					}
				}
			}
	?>
		<tr><td style="width:5%;text-align:center"><input type="checkbox" id="all" style="border:0" value="<?php echo $value['id'];?>" name="all[]" /></td><td style="width:5%; text-align:center"><input name="order[]"  value="<?php if(!empty($value['c_order'])){ echo $value['c_order'];}else{ echo '0';}?>" style="width:30px;" /><input type="hidden" name="order_id[]" value="<?php echo $value['id'];?>" /></td><td style="width:35%"><?php echo "({$value['id']}){$is_has_html}{$fl_str}<a href=\"".CMS_SELF.$content_php."?id={$value['id']}\" target=\"_blank\">{$value['style_title']}</a>";?></td><td style="width:10%; text-align:center"><?php echo date('Y-m-d',$value['addtime']);?></td><td style="width:10%;text-align:center"><a href="?action=content_list&id=<?php echo $value['channel'];?>&cate=<?php echo $value['category'];?>&lang=<?php echo $lang;?>"><?php echo get_cate($value['category']);?></a></td><td style="width:10%;text-align:center"><?php echo get_verify($value['purview']);?></td><td style="width:5%;text-align:center"><?php echo $value['hits'];?></td><td style="width:5%;text-align:center"><?php if($value['verify']){echo "<span style=\"color:red\">未审核</span>";}else{echo "已审核";}?></td><td style="width:5%;text-align:center"><?php echo $value['author'];?></td><td style="width:10%;text-align:center"><a href="javascript:if(confirm('确定要删除么,删除后将不可恢复!')){location.href='?action=del&lang=<?php echo $lang;?>&id=<?php echo $value['id'];?>&channel_id=<?php echo $value['channel'];?>';}" style="padding:0 3px;">删除</a>|<a href="?action=edit_content&lang=<?php echo $lang;?>&id=<?php echo $value['id'];?>&channel_id=<?php echo $value['channel'];?>&cate=<?php echo $value['category'];?>" style="padding:0 3px;">修改</a></td></tr>
		<?php }
		}
		?>
		</tbody>
 </table>
 </div>
 <div class="page_fy page">
		<?php echo page('admin_content.php',$page,$query,$total_num,$total_page,'','1');?>
 </div>
<div class="order_btn">
<input type="hidden" value="<?php echo $id;?>" name="id" /><input type="hidden" value="<?php echo $lang;?>" name="lang" />
  <input type="button" name="order" value="排序" onclick="javascript:this.form.action='admin_content.php?action=order&channel_id=<?php echo $value[channel];?>';this.form.submit();" style="margin:0 10px 0 0;" class="go" /><input type="button" name="all" value="全选" id="sl_all" style="margin:0 10px 0 0;" class="go" /><input type="reset" style="margin:0 10px 0 0;" class="go" value="重置" name="reset"/><input type="button" onclick="javascript:if(confirm('确定要删除么,删除后将不可恢复!')){this.form.action='admin_content.php?action=del_all&step=2&lang=<?php echo $lang;?>&channel_id=<?php echo $value[channel];?>';this.form.submit();}" value="删除" name="button" style="margin:0 10px 0 0;" class="go"/><input type="button" onclick="javascript:this.form.action='?action=verify&step=2&channel_id=<?php echo $value[channel];?>&lang=<?php echo $lang;?>';this.form.submit();" value="审核" name="verify" style="margin:0 10px 0 0;" class="go" /><input type="button" value="添加内容" name="add" onclick="javascript:location.href='?action=add&lang=<?php echo $GLOBALS['lang'];?>&id=<?php echo $id;?>';" style="margin:0 10px 0 0;" class="go"/><input type="button" value="批量转移" name="move" onclick="javascript:this.form.action='?action=arc_move&channel=<?php echo $id;?>&lang=<?php echo $lang;?>';this.form.submit();" style="margin:0 10px 0 0;" class="go"/>
 </div>
</form>
</div><!--内容切换-->

<div class="ie8-height"></div>
</body>
</html>
